package com.haierp.controller;

import java.util.List;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.haierp.model.WxUser;
import com.haierp.service.IWxUserService;
import com.haierp.util.JsonPageResult;
import com.haierp.vo.WxUserVO;
import com.wangzhixuan.commons.base.BaseController;
import com.wangzhixuan.commons.shiro.ShiroUser;


@Controller
@RequestMapping("/wx")
public class WxUserController extends BaseController {

	@Autowired
	private IWxUserService wxUserService;

	/**
	 *
	 * @param
	 * @return
	 */
	@RequestMapping("/queryFans")
	@ResponseBody
	public Object queryFans(WxUserVO wxUserVO, HttpServletRequest request) {
		JsonPageResult<List<WxUser>> result = new JsonPageResult<>();
		ShiroUser shiroUser = this.getShiroUser();
		Set<String> roles = shiroUser.getRoles();
		if(roles.contains("irhsale")) {
			wxUserVO.setSellerId(shiroUser.getId());
		}
		result = wxUserService.queryFans(wxUserVO);
		return result.buildIsSuccess(true);
	}

	
}
